package Driver;

import EventManager.Request;
import EventManager.RequestStatus;
import EventManager.ViewBookingsForEventAdminRequest;
import Model.Booking;
import Model.Event;
import Service.OutputManager;

public class ViewBookingsForEventAdminRequestView extends RequestView 
{
	@Override
	public void view (Request r)
	{
		ViewBookingsForEventAdminRequest req = (ViewBookingsForEventAdminRequest) r; // downcast
		
		OutputManager.println("\n*** Viewing request result of '".toUpperCase() + req.toString().toUpperCase() + "' ***");
		if (RequestStatus.Sustained == r.getStatus())
		{
			OutputManager.println("The request has been sustained.\n");
		}
		else if (RequestStatus.Pending == r.getStatus())
		{
			OutputManager.println("The request is pending.");
			endMessage();
			return;
		}
		else
		{
			OutputManager.println("The request has been refused.");
			endMessage();
			return;
		}
		
		OutputManager.println("Bookings returned: " + req.getBookings().size() + "\n");
		for (Booking b : req.getBookings())
		{
			OutputManager.println(b.toString());
		}
		endMessage();
	}
	
	protected void endMessage()
	{
		OutputManager.println("\n*** END OF VIEW ***");
	}
}
